<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<tr><th width="130px">questionID</th><td>
<script>
function buildForwardForm(type, id, nodeId, responser, forwardTo){
	var url;
	if(type==1){
		url="<%=application.getContextPath() %>/workOrder/forwardOrder.do";
	}else{
		url="<%=application.getContextPath() %>/workOrder/backwardOrder.do";
	}
	str='<form name="forwardForm">'+
		'<input type="hidden" name="questionType" value="${questionType}"/>'+
		'<input type="hidden" name="id" value="'+id+'"/>'+
		'<input type="hidden" name="workFlowNodeId" value="'+nodeId+'"/>'+
		'<input type="hidden" name="responser" value="'+responser+'"/>'+
		'<table class="tb-data" >'+
		'<tr><th>转至</th><td>'+forwardTo+'</td></tr>'+
		'<tr><th>处理等级</th><td>'+
			'<select name="priority">'+
				'<option value="0">函件</option>'+
				'<option value="1">一般件</option>'+
				'<option value="2">急件</option>'+
				'<option value="3">特急件</option>'+
			'</select>'+
		'</td></tr>'+

		'<tr><th>备注</th><td>'+
		'<textarea name="comment" id="theComment" rows="10" cols="50"></textarea>'+
		'</td></tr><tr><th></th><td>'+
		'<input type="button" value="转单" onclick="doAR(\''+url+'\',\'main\', \'forwardForm\');closeDialog()"/>'+
		'<input type="reset" value="重设"/>'+
		'</td>'+
		'</tr>'+
		'</table>'+
		'</form>'
		;
	return str;
}
var content;
function buildApproveForm(id, type){
	var typeName;
	var url;
	if(type==1){
		url="<%=application.getContextPath() %>/workOrder/approveOrder.do";
	}else{
		url="<%=application.getContextPath() %>/workOrder/rejectOrder.do";
	}
	str='<form name="approveForm">'+
		'<input type="hidden" name="id" value="'+id+'"/>'+
		'<table class="tb-data" >'+
		'<tr><th>审核意见</th><td><textarea name="approveComment" id="theComment" rows="10" cols="50"></textarea></td></tr>'+
		'<tr><th></th><td>'+
		'<input type="button" value="送出" onclick="doAR(\''+url+'\',\'main\', \'approveForm\');closeDialog()"/>'+
		'<input type="reset" value="重设"/>'+
		'</td>'+
		'</tr>'+
		'</table>'+'</form>';
	return str;
}
</script>
${question.id}
<input type="hidden" name="id" value="${question.id }"/>
<input type="hidden" name="workOrderId" value="${workOrder.id}"/>
</td></tr>
<tr><th>channel</th>
<td>${pu:get('com.yaodian100.crm.cs.entity.FromChannel', question.channel.id).title}
</td>
</tr>
<tr><th width="130px">问题单类型</th><td>

${questionType }<input type="hidden" name="questionType" value="${questionType}"/>
</td></tr>
<tr><th>会员</th><td><input type="hidden" id="memberId" name="memberId" value="${question.memberId }"/>
<c-rt:if test="${!empty question.memberId && empty member}">
<c-rt:set var="member" value="${pu:get('com.yaodian100.ec.member.entity.Member', question.memberId)}"/>
</c-rt:if>
${member.name }</td></tr>
<tr><th width="130px">短描述</th><td>${question.shortDesc }</td></tr>
<tr><th width="130px">描述</th><td>${question.description }</td></tr>

<tr><th width="130px">前单备注</th><td>${workOrder.comment }</td></tr>

<tr><th width="130px">工单状态</th><td>${pu:menuOption('WorkOrder.status', pu:toString(workOrder.status)).name }
</td></tr>
<c-rt:if test="${pu:username()==workOrder.owner.username && (workOrder.status==0 || workOrder.status==4)}">
	<tr>
	<th>转单</th><td>
    
    <form name="forwardForm">
		<input type="hidden" name="questionType" value="${questionType}"/>
		<input type="hidden" name="id" value="'+id+'"/>
		<input type="hidden" name="workFlowNodeId" value="'+nodeId+'"/>
		<input type="hidden" name="responser" value="'+responser+'"/>
		<table class="tb-data" >
		<tr><th>转至</th><td>'+forwardTo+'</td></tr>
		<tr><th>处理等级</th><td>
			<select name="priority">
				<option value="0">函件</option>
				<option value="1">一般件</option>
				<option value="2">急件</option>
				<option value="3">特急件</option>
			</select>
		</td></tr>

		<tr><th>备注</th><td>
		<textarea name="comment" id="theComment" rows="10" cols="50"></textarea>
		</td></tr><tr><th></th><td>
		<input type="button" value="转单" onclick="doAR('','main', 'forwardForm');closeDialog()"/>
		<input type="reset" value="重设"/>
		</td>
		</tr>
		</table>
	</form>
    <%--
	<c-rt:if test="${question.type.name=='CommonQuestion' }">
		<c-rt:set var="cqt" value="${pu:get('com.yaodian100.crm.cs.entity.CommonQuestionType', question.extraValue['commonQuestionType'].value) }"/>
			<c-rt:set var="workFlowName" value="${cqt.workFlowName}"/>

	</c-rt:if>
	<c-rt:if test="${question.type.name!='CommonQuestion'}">
		<c-rt:set var="workFlowName" value="${question.type.workFlowName}"/>
	</c-rt:if>
	<c-rt:if test="${!empty workFlowName}">
		<c-rt:if test="${empty workOrder.node}">
			<c-rt:set var="params" value="${pu:addToList('paras', workFlowName)}"/>
			<c-rt:set var="hql">
			from WorkFlowNode where workFlow.name=? and parent is null
			</c-rt:set>
			<c-rt:set var="workFlowNodes" value="${pu:queryByHql(hql, params, null)}"/>
			<c-rt:if test="${empty workFlowNodes}">
			无法转单
			</c-rt:if>
			<c-rt:forEach items="${workFlowNodes}" var="workFlowNode">
			<input type="button" onclick="openDialog('转单', buildForwardForm(1,'${workOrder.id}', '${workFlowNode.id }', '${workFlowNode.responser }', '${workFlowNode.shortDesc }'), 500,400)" value="${workFlowNode.shortDesc }"/>
			</c-rt:forEach>
		</c-rt:if>
		<c-rt:if test="${!empty workOrder.node}">
			<c-rt:if test="${workOrder.node.allowBackward}">
			<input type="button" onclick="openDialog('转单', buildForwardForm(2,'${workOrder.id}', '${workOrder.parent.node.id }', '${workOrder.parent.node.responser }', '退回'), 500,400)" value="回上一层"/>
			</c-rt:if>
			<c-rt:set var="params" value="${pu:addToList('paras', workOrder.node.id)}"/>
			<c-rt:set var="hql">
			from WorkFlowNode where parent.id=?
			</c-rt:set>
			<c-rt:set var="workFlowNodes" value="${pu:queryByHql(hql, params, null)}"/>
			<c-rt:if test="${empty workFlowNodes}">
			无法转单
			</c-rt:if>
			<c-rt:forEach items="${workFlowNodes}" var="workFlowNode">
			<input type="button" onclick="openDialog('转单', buildForwardForm(1,'${workOrder.id}', '${workFlowNode.id }', '${workFlowNode.responser }', '${workFlowNode.shortDesc }'), 500,400)" value="${workFlowNode.shortDesc }"/></a>
			</c-rt:forEach>
		</c-rt:if>
	</c-rt:if>
    --%>
	</td>
	</tr>
</c-rt:if>
<c-rt:if test="${pu:username()==workOrder.owner.username && (workOrder.status==0 || workOrder.status==4)}">
	<tr><th width="130px">注解</th><td>
	<textarea name="note"></textarea>
	</td></tr>
	<tr>
	<th>结束码</th>
	<td>
	<a href="javascript:;" onclick="doAR('<%=application.getContextPath() %>/workOrder/page.do?iamlazy=terminateCode&AJAX=true&refreshZone=terminateCodeZone', 'terminateCodeZone')">选择</a>
	<span id="terminateCodeZone">
	
	</span>
	</td>
	</tr>
</c-rt:if>
<c-rt:if test="${workOrder.approver==pu:username() && workOrder.approveStatus==0}">
	<tr><th width="130px">审核</th><td>
	<input type="button" value="核可" onclick="openDialog('核可', buildApproveForm('${workOrder.id}', 1))"/> <input type="button" value="注销" onclick="openDialog('注销', buildApproveForm('${workOrder.id}', 2), 500,400)"/>
	</td></tr>
	
</c-rt:if>

